<template>
  <el-dialog
    :visible="showDialog"
    top="10vh"
    width="800px"
    :show-close="false"
    @close="handleClose"
  >
    <template #title>
      <div style="background: orange">
        <h2 style="text-align: center">
          😏🥶🤬🤢🥸👿👻👽👾🤖💩😾🙈🦓🐴🦄🐔🌭🍟🥨🥯🥖🧑‍🎄🎅
        </h2>
        <h2 style="text-align: center">修改文章</h2>
      </div>
    </template>
    <!-- 表单区域 -->
    <el-form label-width="120px">
      <el-form-item label="文章标题：">
        <el-input v-model="subjectData.title" />
      </el-form-item>
      <el-form-item label="文章内容：">
        <!-- 使用 v-model 进行双向的数据绑定 -->
        <quill-editor v-model="subjectData.articleBody" />
      </el-form-item>
      <el-form-item label="视频地址：">
        <el-input v-model="subjectData.videoURL" />
      </el-form-item>
    </el-form>
    <template #footer>
      <el-button type="primary" @click="handelreset">修改</el-button>
    </template>
  </el-dialog>
</template>

<script>
import { resetInserviewAPI } from '@/api/interview'
export default {
  name: 'ResetInfoCom',
  props: {
    showDialog: {
      type: Boolean,
      default: false
    },
    subjectData: {
      type: Object,
      required: true
    }
  },
  created() {
    console.log('文章详情', this.subjectData)
  },
  methods: {
    // 修改
    async handelreset() {
      try {
        const resp = await resetInserviewAPI(this.subjectData)
        console.log(resp)
        await this.$message.success('修改成功🧠')
        this.handleClose()
      } catch (error) {
        console.log(error)
      }
    },
    // 关闭弹窗
    async handleClose() {
      this.$emit('add-success')
      this.$emit('closeDialog')
    }
  }
}
</script>

<style lang="scss" scoped>
// 设置富文本编辑器的默认最小高度
::v-deep .ql-editor {
  min-height: 300px;
}
</style>
